#ifndef TCP_H
#define TCP_H

#include <QWidget>
#include <QFileInfo>
#include <QFileDialog>
#include <QMessageBox>
#include <QTcpSocket>
#include <QTimer>
#include <QListWidgetItem>
#include <QStandardPaths>
#include <QHostInfo>
#include <QNetworkInterface>
#include <QDir>
#include <QList>
#include <QTcpServer>

namespace Ui {
class tcp;
}

class tcp : public QWidget
{
    Q_OBJECT

public:
    explicit tcp(QWidget *parent = nullptr);
    QTcpSocket *socket;
    QTimer *myTimer;
    qint16 flag;
    void sendData();
    void recvFileInfo(QByteArray &arr);
    void downLoad(QByteArray &arr);
    void recvData();
    QString getHostIpAddress();
    QString share_ip;

    QString fileName, fileServer,filePath;
    qint64 fileSize, recvSize,sendSize;


    QTcpServer *server;
    QFile file;
    ~tcp();

private slots:
    void on_btnC_clicked();

    void on_btnFile_clicked();

    void on_btnSend_clicked();

    void on_btnDown_clicked();

    void on_serverFile_itemClicked(QListWidgetItem *item);

    void on_btnLook_clicked();

    void on_confirm_shareip_clicked();

    void on_recept_clicked();

    void on_refresh_clicked();

private:
    Ui::tcp *ui;
};

#endif // TCP_H
